<template>
  <div class="image-player" @tap="onPreview">
    <image :src="srcUrl" mode="widthFix"></image>
  </div>
</template>

<script>
import { mapGetters, mapActions } from 'vuex'
const COS_ADDR = 'https://ark-1256750454.picsh.myqcloud.com/'

export default {
  props: {
    path: {
      type: String
    },
  },
  computed: {
    srcUrl() {
      if (this.path.indexOf('//') >= 0) return this.path
      return COS_ADDR + this.path + '!s1'
    },
  },
  methods: {
    onPreview () {
      let url = this.srcUrl.replace('!s1', '')
      wx.previewImage({
        urls: [url]
      })
    }
  }
}
</script>

<style scoped lang="less">
@import '../assets/less/var.less';
</style>
